<template>
  <div class="app-container">
    <el-table
      v-loading="listLoading"
      :data="list"
      element-loading-text="Loading"
      height="600"
      border
      style="width: 100%">
      <el-table-column type="index" align="center" fixed>

      </el-table-column>
      <el-table-column label="品种" align="center" fixed>
        <el-table-column label="成品新编码" fixed prop="newCode"></el-table-column>
        <el-table-column label="老编码" fixed prop="oldCode"></el-table-column>
      </el-table-column>

      <el-table-column label="零件名称" fixed prop="partName"></el-table-column>
      <el-table-column label="半成品编码" fixed prop="banCode"></el-table-column>
      <el-table-column label="总月计划数" fixed prop="mouthCount"></el-table-column>

      <!--TODO fixed属性的BUG待解决-->
      <el-table-column label="NULL" fixed> </el-table-column>


      <el-table-column label="2019" align="center">
        <el-table-column label="第一周" align="center">
          <el-table-column v-for="(item, index) in 3" label="" >
            <template slot-scope="scope">
              <span>{{scope.row.y_2019_1[index]}}</span>
            </template>
          </el-table-column>
          <el-table-column v-for="(item, index) in 3" :label="index+28" >
            <template slot-scope="scope">
              <span>{{scope.row.y_2019_1[index+3]}}</span>
            </template>
          </el-table-column>
          <el-table-column v-for="(item, index) in 5" :label="index+1" >
            <template slot-scope="scope">
              <span>{{scope.row.y_2019_1[index+6]}}</span>
            </template>
          </el-table-column>
          <el-table-column v-for="(item, index) in 1" label="28-25" >
            <template slot-scope="scope">
              <span>{{scope.row.y_2019_1[index+11]}}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="第二周" align="center">
          <el-table-column v-for="(item, index) in 7" :label="index+6" >
            <template slot-scope="scope">
              <span>{{scope.row.y_2019_2[index]}}</span>
            </template>
          </el-table-column>
          <el-table-column v-for="(item, index) in 1" label="6-12" >
            <template slot-scope="scope">
              <span>{{scope.row.y_2019_2[index+7]}}</span>
            </template>
          </el-table-column>
        </el-table-column>
        <el-table-column label="第三周">

        </el-table-column>
        <el-table-column label="第四周">

        </el-table-column>
        <el-table-column label=" ">

        </el-table-column>
      </el-table-column>
      <el-table-column label="坯件进度">
        <el-table-column label="来料">

        </el-table-column>
        <el-table-column label="本月投料">

        </el-table-column>
        <el-table-column label="合计投料">

        </el-table-column>
        <el-table-column label="主盆齿差额">

        </el-table-column>
        <el-table-column label="第一周差件">

        </el-table-column>
        <el-table-column label="第二周差件">

        </el-table-column>
        <el-table-column label="第三周差件">

        </el-table-column>
        <el-table-column label="投料月差">

        </el-table-column>
      </el-table-column>

    </el-table>
  </div>
</template>

<script>
import { fetchList } from '@/api/yuanche2'

export default {
  data() {
    return {
      list: null,
      listLoading: true
    }
  },
  created() {
    this.getList()
  },
  methods: {
    getList() {
      this.listLoading = true
      fetchList().then(response => {
        this.list = response.data
        setTimeout(() => {
          this.listLoading = false
        }, 1.5 * 1000)
      })
    }
  }
}
</script>
